package cn.edu.config;

import cn.edu.interceptor.JWTInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @PackageName: cn.edu.config
 * @ClassName: InterceptorConfig
 * @Description:
 * @author: RZS
 * @date: 2021/7/14  23:33
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptor())
                // 其他接口保护
                .addPathPatterns("/user/test")
                // 所有用户放行
                .excludePathPatterns("/user/login");
    }
}
